#define _CRT_SECURE_NO_WARNINGS   1

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	vector<char>st;
	st.push_back(s[0]);
	for (int i = 1; i<s.length(); i++)
	{
		if (s[i] == st.back())
		{
			st.pop_back();
			continue;
		}
		st.push_back(s[i]);
	}
	if (st.empty())
		cout << "0" << endl;
	else
	{
		for (int i = 0; i<st.size(); i++)
			cout << st[i];
	}
	cout << endl;
	return 0;
}